package com.yanghang.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yanghang.dao.RecordDao;
import com.yanghang.entity.Record;
import com.yanghang.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class RecordServiceImpl implements RecordService {
    @Autowired
    private RecordDao rd;

    @Transactional(readOnly = true)
    @Override
    public PageInfo<Record> selectByPage(int pageNum, int pageSize, String startTime, String endTime) {
        PageHelper.startPage(pageNum, pageSize);
        List<Record> list = rd.selectByTime(startTime, endTime);
        return new PageInfo<>(list);
    }
}
